package com.poizon.config;

import io.swagger.annotations.Api;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @ClassName SwaggerConfig
 * @Author NoCheng
 * @Date 2022/1/2 9:34
 * @Description:TODO API接口测试配置类
 */

@Configuration
@EnableSwagger2
public class SwaggerConfig {

    public ApiInfo createApi(){
        return new ApiInfoBuilder().description("poizon项目的在线接口文档,接口测试")
                .title("poizon项目的在线接口文档").contact(new Contact("第十一组","","1578150029@qq.com"))
                .version("1.0.0").build();
    }

    @Bean
    public Docket createDocket(){
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(createApi())
                .select().apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
                .build();
    }

}
